home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Practical Algorithms for Image Analysis
/
Practical Algorithms for Image Analysis.iso
/
CH_6.4
/
XKNN
/
XKNN.H
< prev
next >
Wrap
C/C++ Source or Header
|
1999-09-11
|
1KB
|
50 lines
/*
* xknn.h
*
* Practical Algorithms for Image Analysis
*
* Copyright (c) 1997, 1998, 1999 MLMSoftwareGroup, LLC
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <malloc.h>
#include <search.h>
#include "ip.h"
/*
* Structures for KNN points
*/
struct KNN {
int x_pos; /* x-coordinate */
int y_pos; /* y-coordinate */
int distSqd; /* distance squared from point */
};
struct Point {
int x_pos; /* x-coordinate */
int y_pos; /* y-coordinate */
struct KNN *Knn; /* pointer to the KNN for this point */
int nNN; /* number of nearest neighbors found */
};
/*
* Function prototypes
*/
extern int main (int, char **);
extern void usage (char *);
struct Point *readPoints (char *, int);
#if defined(LINUX)
extern int sortX (struct Point *p1, struct Point *p2);
extern int sortY (struct Point *p1, struct Point *p2);
#else
extern int sortX (const void *point1, const void *point2);
extern int sortY (const void *point1, const void *point2);
#endif
extern void find_knn (struct Point *, int, int, int);
extern int insertNN (struct Point *, struct Point *, long, int);